<template>
  <div class="news">
    <div class="banner">
      <img :src="ban1" alt="">
    </div>
    <div class="edit-box container">
      <p class="p-head">{{info.title}}</p>
      <div class="cont-box" v-html="info.content">
      </div>
    </div>
  </div>
</template>

<script>
import ban1 from '@/assets/image/ban1.jpg';
import cp1 from '@/assets/image/cp1.jpg';
export default {
  name: 'App',
  data(){
    return{
      ban1,cp1,
      info:[]
    }
  },
  methods:{
    getinfo:function(){
      let infoid = this.$route.query.infoid
      console.log(infoid);
      this.$http.get("/index.php/index/service/getInfo?ids="+infoid)
            .then(res => {
              this.info = res.data
            })
            .catch(error => {
              
            });
    }
  },
  components:{
    
  },
  created(){
    this.getinfo();
  },
  watch:{
          '$route' (to, from) {
                // this.getinfo()
               //   const toDepth = to.path.split('/').length
                // const fromDepth = from.path.split('/').length
                // this.transitionName = toDepth < fromDepth ? 'slide-right' : 'slide-left'
                // console.log(to.name)
                if(to.name == 'info'){
                  this.getinfo();
                }
              }
        }
}
</script>

<style scoped lang="less">
.news{
  width: 100%;
  height: auto;
  zoom: 1;
  overflow: hidden;
  .banner{
    width: 100%;
    height: auto;
    zoom: 1;
    overflow: hidden;
    img{
      width: 100%;
    }
  }
  
}
.edit-box{
  height: auto;
  zoom: 1;
  overflow: hidden;
  margin-top: 30px;
  .p-head{
    font-size: 20px;
    color: #2e2e2e;
    text-align: center;
  }
  .cont-box{
    margin-top: 20px;
  }
  img{
    display: block;
    margin-top: 20px;
    margin-bottom: 20px;
    max-width: 100%;
  }
}
</style>
